Establishing the Preferred Printing Characteristics
QuickDraw GX sends theGXDefaultJob
message to initialize a new job object. You can override this message, which is described on page 4-47 in the chapter "Printing Messages," to add collections to the job or to establish printing preferences for the job.The ImageWriter II printer driver overrides the
GXDefaultJob
message to add an item to the job collection that stores the preferred printing resolution and to initialize that preference to the highest resolution possible. This message override, theSD_DefaultJob
function, is shown in Listing 3-6.Listing 3-6 Establishing the printing resolution for the ImageWriter II printer
OSErr SD_DefaultJob() { OSErr anErr; anErr = Forward_GXDefaultJob(); if (anErr == noErr) { long imagewriterOptions = kSuperRes; /* add high resolution preference item */ anErr = AddCollectionItem(GXGetJobCollection(GXGetJob()), DriverCreator, 0, sizeof(imagewriterOptions), &imagewriterOptions); } return(anErr); }TheSD_DefaultJob
function adds an item to the job collection. Other printer drivers override theGXDefaultJob
message for similar purposes. For example, one vector printer driver overrides this message to create a number of collection items that are used in its other functions. These items, which are added to the job collection, include the current carousel list, pen list, pens dialog box settings, and plot-quality settings.When a user chooses the Page Setup dialog box, QuickDraw GX sends the
GXJobDefaultFormatDialog
message, which you can override to modify the contents of the dialog box. The ImageWriter II printer driver override of this message,SD_JobFormatDialog
, determines if the job includes support for using the text-mode printing capabilities of the ImageWriter II, as shown in Listing 3-7. If the job does support text-mode printing, then text mode becomes the preferred printing mode. TheGXJobDefaultFormatDialog
message is described on page 4-82 in the chapter "Printing Messages."Listing 3-7 Determining the preferred job-formatting mode
OSErr SD_JobFormatDialog(gxDialogResult *theResult) { OSErr anErr; gxJobFormatModeTableHdl theJobFormatModeList; long i; gxJob theJob = GXGetJob(); /* set up the job format mode information */ anErr = GXGetAvailableJobFormatModes(&theJobFormatModeList); if ((!anErr) && (theJobFormatModeList)) { for (i = 0; i <= (*theJobFormatModeList)->numModes - 1; ++i) { if ((*theJobFormatModeList)->modes[i] == gxTextJobFormatMode) { GXSetPreferredJobFormatMode(gxTextJobFormatMode, false); break; } } DisposHandle((Handle)theJobFormatModeList); } /*do normal dialogs after handling job format mode stuff */ return(Forward_GXJobDefaultFormatDialog(theResult)); }TheSD_JobFormatDialog
function calls theGXGetAvailableJobFormatModes
function to determine which formatting modes the application supports. If text formatting mode is supported,SD_JobFormatDialog
makes that the preferred 0mode by calling theGXSetPreferredJobFormatMode
function. TheGXGetAvailableJobFormatModes
function is described on page 5-30 and theGXSetPreferredJobFormatMode
function is described on page 5-30 in the chapter "Printing Functions for Message Overrides."
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help